<template>
    <div class="member-list">
        <div class="member-list-card">
            <div class="member-list-head">
                <Row :gutter="5" style="margin-bottom: 10px">
                    <!--<Col span="4">-->
                    <!--<DatePicker  clearable v-model="searchData.timeStartEnd" style="width: 100%" type="daterange" placeholder="时间筛选"></DatePicker>-->
                    <!--</Col>-->
                    <!--<Col span="4">-->
                    <!--<Input clearable v-model="searchData.loginName" placeholder="登录名" type="text"></Input>-->
                    <!--</Col>-->
                    <Col span="4">
                        <Select v-model="searchData.id" placeholder="帐号状态">
                            <Option v-for="(coin,index) in coinList" :key="index" :value="coin.id">
                                {{coin.buy_name}}/{{coin.sell_name}}
                            </Option>
                        </Select>
                    </Col>
                    <Col span="4">
                        <Input clearable v-model="searchData.userName" placeholder="用户名" type="text"></Input>
                    </Col>
                    <Col span="4">
                        <Input clearable v-model="searchData.userPhone" placeholder="用户电话" type="text"></Input>
                    </Col>
                    <!--<Col span="4">-->
                    <!--<Input clearable v-model="searchData.email" placeholder="邮箱" type="text"></Input>-->
                    <!--</Col>-->
                    <!--<Col span="4">-->
                    <!--<Select clearable v-model="searchData.userLevel" placeholder="会员等级">-->
                    <!--<Option :value="1">VIP会员</Option>-->
                    <!--<Option :value="2">金卡会员</Option>-->
                    <!--<Option :value="3">钻石会员</Option>-->
                    <!--<Option :value="4">红钻会员</Option>-->
                    <!--<Option :value="5">皇钻会员</Option>-->
                    <!--</Select>-->
                    <!--</Col>-->
                    <Col span="4">
                        <Select clearable v-model="searchData.userStatus" placeholder="状态">
                            <Option :value="2">部分成交</Option>
                            <Option :value="-1">撤单</Option>
                            <Option :value="1">挂单</Option>
                        </Select>
                    </Col>
                    <!--</Row>-->
                    <!--<Row :gutter="5">-->
                    <Col span="4">
                        <Select clearable v-model="searchData.type" placeholder="种类">
                            <Option :value="'buy'">买入</Option>
                            <Option :value="'sell'">卖出</Option>
                        </Select>
                    </Col>
                    <!--<Col span="4">-->
                    <!--<Select clearable v-model="searchData.svip" placeholder="是否是金牌代理">-->
                    <!--<Option :value="1">是</Option>-->
                    <!--<Option :value="0">否</Option>-->
                    <!--</Select>-->
                    <!--</Col>-->
                    <!--<Col span="4">-->
                    <!--<Select clearable v-model="searchData.is_daili" placeholder="是否是为区代">-->
                    <!--<Option :value="1">是</Option>-->
                    <!--<Option :value="0">否</Option>-->
                    <!--</Select>-->
                    <!--</Col>-->
                    <Col span="30">
                        <ButtonGroup class="subSearch">
                            <!--<Button @click="$router.push({name:'member-add-nocache'})" type="primary" icon="plus-round">新增</Button>-->
                            <Button :loading="search_loading" @click="searchGetList" type="primary">
                                <Icon type="ios-pulse-strong"></Icon>
                                筛 选
                            </Button>
                        </ButtonGroup>
                    </Col>
                </Row>
            </div>
            <i-table height="645" stripe :columns="columns" :data="data"></i-table>
            <div style="padding: 15px;">
                <Page @on-page-size-change="changeTiao" @on-change="changePage" :current="index" :total="total"
                      show-elevator show-sizer :placement="'top'" :page-size="page_con"
                      :page-size-opts="[10, 15, 20, 30, 40, 50]"></Page>
            </div>
        </div>
        <!--激活-->
        <Modal v-model="modal9" width="360">
            <p slot="header" style="color:#f60;text-align:center">
                <Icon type="information-circled"></Icon>
                <span>激活确认</span>
            </p>
            <div style="text-align:center">
                <p>是否确认激活？</p>
            </div>
            <div slot="footer">
                <Button type="error" size="large" long :loading="modal_loading" @click="sureActive">确认激活</Button>
            </div>
        </Modal>
        <!--删除-->
        <Modal v-model="modal1" width="360">
            <p slot="header" style="color:#f60;text-align:center">
                <Icon type="information-circled"></Icon>
                <span>取消确认</span>
            </p>
            <div style="text-align:center">
                <p>是否继续取消？</p>
            </div>
            <div slot="footer">
                <Button type="error" size="large" long :loading="modal_loading" @click="del">取消</Button>
            </div>
        </Modal>
        <!--成为团队长-->
        <!--<Modal v-model="modal2" width="360">-->
        <!--<p slot="header" style="text-align:center">-->
        <!--<a>{{type==1?"成为团队长":"取消团队长"}}</a>-->
        <!--</p>-->
        <!--<div style="text-align:center">-->
        <!--<p>是否{{type==1?"成为团队长":"取消团队长"}}？</p>-->
        <!--</div>-->
        <!--<div slot="footer">-->
        <!--<Button type="primary" size="large" long :loading="modal_loading" @click="tuandui">确定</Button>-->
        <!--</div>-->
        <!--</Modal>-->
        <!--升级金牌-->
        <!--<Modal v-model="modal3" width="360">-->
        <!--<p slot="header" style="text-align:center">-->
        <!--<a>升级金牌</a>-->
        <!--</p>-->
        <!--<div style="text-align:center">-->
        <!--<p>是否升级金牌？</p>-->
        <!--</div>-->
        <!--<div slot="footer">-->
        <!--<Button type="primary" size="large" long :loading="modal_loading" @click="shengji">确定</Button>-->
        <!--</div>-->
        <!--</Modal>-->
        <!--修改密码-->
        <!--修改会员等级-->
        <Modal v-model="modal4" width="360">
            <p slot="header" style="text-align:center">
                <a>修改会员等级</a>
            </p>
            <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="70"
                  style="margin-top: 20px">
                <FormItem label="级别" prop="level">
                    <RadioGroup v-model="formValidate.level">
                        <Radio label="1">vip会员</Radio>
                        <Radio label="2">金卡会员</Radio>
                        <Radio label="3">钻石会员</Radio>
                        <Radio label="4">红钻会员</Radio>
                        <Radio label="5">皇钻会员</Radio>
                    </RadioGroup>
                </FormItem>
            </Form>
            <div slot="footer">
                <Button type="primary" size="large" long :loading="modal_loading" @click="changeLevel">确定</Button>
            </div>
        </Modal>
        <!--修改会员激活状态 status-->
        <Modal v-model="memberstatus" width="360">
            <p slot="header" style="text-align:center">
                <a>修改会员激活状态</a>
            </p>
            <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="70"
                  style="margin-top: 20px">
                <FormItem label="状态" prop="status">
                    <RadioGroup v-model="formValidate.status">
                        <Radio label="-2">冻结</Radio>
                        <Radio label="99">注册会员</Radio>
                        <Radio label="1">正式会员</Radio>
                    </RadioGroup>
                </FormItem>
            </Form>
            <div slot="footer">
                <Button type="primary" size="large" long :loading="modal_loading" @click="changeStatus">确定</Button>
            </div>
        </Modal>
        <!--查看会员资金-->
        <Modal v-model="getUserMoney" width="360">
            <p slot="header" style="text-align:center">
                <a>查看用户资金</a>
            </p>
            <Form v-for="(money,index) in moneylist" :key="index" ref="formValidate" :model="formValidate"
                  :rules="ruleValidate" :label-width="70" style="margin-top: 20px">
                <FormItem :label="money.money_type_name" prop="money">
                    <Input v-model="money.num" :placeholder="money.money_type_name" readonly></Input>

                </FormItem>
            </Form>

            <!--<div slot="footer">-->
            <!--<Button type="primary" size="large" long :loading="modal_loading" @click="changeMoney">修改</Button>-->
            <!--</div>-->
        </Modal>
        <!--修改会员资金-->
        <Modal v-model="changeUserMoney" width="360">
            <p slot="header" style="text-align:center">
                <a>修改用户资金</a>
            </p>
            <Form :key="index" ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="70"
                  style="margin-top: 20px">
                <FormItem label="资金种类" prop="change_money_type">
                    <Select clearable v-model="changeMoneyType" placeholder="资金种类">
                        <Option v-for="(money,key) in moneylist" :value="money.currency_id" :key="key">
                            {{money.money_type_name}}
                        </Option>
                        <!--<Option :value="1">本金</Option>-->
                        <!--<Option :value="2">积分</Option>-->
                    </Select>
                </FormItem>
                <!--<FormItem label="资金种类" prop="change_money_type">-->
                <!--<RadioGroup v-model="formValidate.change_money_type">-->
                <!--<Radio label="1">本金</Radio>-->
                <!--<Radio label="2">积分</Radio>-->
                <!--</RadioGroup>-->
                <!--</FormItem>-->
                <FormItem label="增加/减少" prop="inc_type">
                    <RadioGroup v-model="formValidate.inc_type">
                        <Radio label="1">增加</Radio>
                        <Radio label="2">减少</Radio>
                    </RadioGroup>
                </FormItem>
                <FormItem label="更改数量" prop="num">
                    <Input v-model="formValidate.num" placeholder="请输入数量"></Input>
                </FormItem>

            </Form>
            <Input type="text" placeholder="备注" v-model="formValidate.remark"></Input>
            <div slot="footer">
                <Button type="primary" size="large" long :loading="modal_loading" @click="changeMoney">修改</Button>
            </div>
        </Modal>
        <Modal v-model="get_myteam" width="360">
            <p slot="header" style="text-align:center">
                <a>修改会员等级</a>
            </p>
            <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="70"
                  style="margin-top: 20px">
                <FormItem label="级别" prop="level">
                    <RadioGroup v-model="formValidate.level">
                        <Radio label="1">vip会员</Radio>
                        <Radio label="2">金卡会员</Radio>
                        <Radio label="3">钻石会员</Radio>
                        <Radio label="4">红钻会员</Radio>
                        <Radio label="5">皇钻会员</Radio>
                    </RadioGroup>
                </FormItem>
            </Form>
            <div slot="footer">
                <Button type="primary" size="large" long :loading="modal_loading" @click="changeLevel">确定</Button>
            </div>
        </Modal>
        <!--设为代理-->
        <!--<Modal v-model="modal5" width="360">-->
        <!--<p slot="header" style="text-align:center">-->
        <!--<a>设为代理</a>-->
        <!--</p>-->
        <!--<Form ref="formValidateAgent" :model="formValidateAgent" :rules="ruleValidateAgent" :label-width="100" style="margin-top: 20px">-->
        <!--<FormItem label="选择地址(省)" prop="areaId1">-->
        <!--<Select clearable v-model="formValidateAgent.areaId1" placeholder="选择地址(省)" @on-change="getAreaId2">-->
        <!--<Option v-for="(value,key) in areaId1List" :value="value.areaid">{{value.areaname}}</Option>-->
        <!--</Select>-->
        <!--</FormItem>-->
        <!--<FormItem label="选择地址(市)" prop="areaId2">-->
        <!--<Select clearable v-model="formValidateAgent.areaId2" placeholder="选择地址(市)" @on-change="getAreaId3">-->
        <!--<Option v-for="(value,key) in areaId2List" :value="value.areaid">{{value.areaname}}</Option>-->
        <!--</Select>-->
        <!--</FormItem>-->
        <!--<FormItem label="选择地址(县)" prop="areaId3">-->
        <!--<Select clearable v-model="formValidateAgent.areaId3" placeholder="选择地址(县、区)">-->
        <!--<Option v-for="(value,key) in areaId3List" :value="value.areaid">{{value.areaname}}</Option>-->
        <!--</Select>-->
        <!--</FormItem>-->
        <!--<FormItem label="推荐人" prop="tuijian">-->
        <!--<Input type="password" v-model="formValidateAgent.tuijian" placeholder="请输入推荐人"></Input>-->
        <!--</FormItem>-->
        <!--<FormItem label="选择类型" prop="type">-->
        <!--<Select clearable v-model="formValidateAgent.type" placeholder="请选择类型">-->
        <!--<Option value="2">设为代理</Option>-->
        <!--<Option value="1">设为预定</Option>-->
        <!--</Select>-->
        <!--</FormItem>-->
        <!--</Form>-->
        <!--<div slot="footer">-->
        <!--<Button type="primary" size="large" long :loading="modal_loading" @click="setAgent">确定</Button>-->
        <!--</div>-->
        <!--</Modal>-->
    </div>
</template>
<script>
    export default {
        name: "autoBuySell-list",
        data() {
            return {
                moneylist: [],
                columns: [
                    {
                        title: '序号',
                        type: 'index',
                        width: 60,
                        align: "center",
                    },
                    // {
                    //     title: '登录名',
                    //     key: 'loginname',
                    //     align:"center",
                    // },
                    {
                        title: '用户名',
                        key: 'username',
                        align: "center",
                    },
                    {
                        title: '手机号码',
                        key: 'phone',
                        align: "center",
                    },
                    {
                        title: '状态',
                        key: 'status',
                        align: "center",
                        render: (h, params) => {
                            if (params.row.status == 1) {
                                return '挂单'
                            }
                            else if (params.row.status == -1) {
                                return '撤单'
                            }
                            else {
                                return '部分成交'
                            }
                        }
                    },


                    // {
                    //     title: '激活状态',
                    //     key: 'is_jihuo',
                    //     align: "center",
                    //     render: (h, params) => {
                    //         return ` ${params.row.is_jihuo == 1 ? '已激活' : '未激活'}`
                    //     }
                    // },
                    {
                        title: '数量',
                        key: 'num',
                        align: "center",
                    },
                    {
                        title: '交易数量',
                        key: 'trade_num',
                        align: "center",
                    },
                    // {
                    //     title: '等级',
                    //     key: 'tuijian_id',
                    //     align:"center",
                    //     render:(h,params)=>{
                    //         if(params.row.vip==0&&params.row.svip==0){
                    //             return "会员"
                    //         }else if(params.row.vip==1&&params.row.svip==0){
                    //             return "代理"
                    //         }else if(params.row.vip==1&&params.row.svip==1){
                    //             return "金牌代理"
                    //         }else if(params.row.vip==0&&params.row.svip==1){
                    //             return "金牌代理"
                    //         }
                    //     }
                    // },
                    // {
                    //     title: '会员等级',
                    //     key: 'level_name',
                    //     align: "center",
                    // },
                    {
                        title: '价格',
                        key: 'price',
                        align: "center",
                    },
                    {
                        title: '买卖',
                        key: 'type',
                        align: "center",
                    },
                    {
                        title: '时间',
                        key: 'add_time',
                        align: "center",
                        render: (h, params) => {
                            return this.timeFormat(params.row.add_time)
                        }
                    },
                    // {
                    //     title: '是否为区代',
                    //     key: 'is_daili',
                    //     width:100,
                    //     align:"center",
                    //     render:(h,params)=>{
                    //         if(params.row.is_daili==1){
                    //             return h("Icon",
                    //                 {
                    //                     props:{
                    //                         type:"checkmark-round",
                    //                         color:"green",
                    //                     }
                    //                 }
                    //             )
                    //         }else{
                    //             return h("Icon",
                    //                 {
                    //                     props:{
                    //                         type:"close-round",
                    //                         color:"red",
                    //                     }
                    //                 }
                    //             )
                    //         }
                    //     }
                    // },
                    // {
                    //     title: '是否启用',
                    //     key: 'userstatus',
                    //     width:100,
                    //     align:"center",
                    //     render:(h,params)=>{
                    //         if(params.row.userstatus==1){
                    //             return h("Icon",
                    //                 {
                    //                     props:{
                    //                         type:"checkmark-round",
                    //                         color:"green",
                    //                     }
                    //                 }
                    //             )
                    //         }else{
                    //             return h("Icon",
                    //                 {
                    //                     props:{
                    //                         type:"close-round",
                    //                         color:"red",
                    //                     }
                    //                 }
                    //             )
                    //         }
                    //     }
                    // },
                    // {
                    //     title: '是否为团队长',
                    //     key: 'tuandui',
                    //     width:115,
                    //     align:"center",
                    //     render:(h,params)=>{
                    //         if(params.row.tuandui==1){
                    //             return h("Icon",
                    //                 {
                    //                     props:{
                    //                         type:"checkmark-round",
                    //                         color:"green",
                    //                     }
                    //                 }
                    //             )
                    //         }else{
                    //             return h("Icon",
                    //                 {
                    //                     props:{
                    //                         type:"close-round",
                    //                         color:"red",
                    //                     }
                    //                 }
                    //             )
                    //         }
                    //     }
                    // },
                    // {
                    //     title: '生日',
                    //     key: 'birthday',
                    //     align: "center",
                    //     render: ((h, params) => {
                    //         if (params.row.year == '1880') {
                    //             return '暂无'
                    //         }
                    //         else {
                    //             return this.birthday = params.row.year + "-" + params.row.month + '-' + params.row.day
                    //         }
                    //     })
                    // },
                    {
                        title: '操作',
                        key: 'action',
                        align: 'center',
                        width: 200,
                        render: (h, params) => {
                            if (params.row.status != -1) {
                                return h("div", [
                                    h("ButtonGroup", {
                                        style: {
                                            marginTop: "5px"
                                        }
                                    }, [
                                        // h("Button", {
                                        //     props: {
                                        //         type: "primary"
                                        //     },
                                        //     on: {
                                        //         click: () => {
                                        //             this.$router.push({
                                        //                 name: 'member-add-nocache',
                                        //                 query: {isEdit: true, uid: params.row.uid}
                                        //             })
                                        //         }
                                        //     }
                                        // }, "编 辑"),
                                        h("Button", {
                                            props: {
                                                type: "error"
                                            },
                                            on: {
                                                click: () => {
                                                    this.uid = params.row.uid
                                                    this.order_type = params.row.type
                                                    this.modal1 = true
                                                }
                                            }
                                        }, "撤 单"),
                                    ]),
                                    h("ButtonGroup", {
                                        style: {
                                            margin: "5px 0px"
                                        }
                                    }, [
                                        // h("Button",{
                                        //     props:{
                                        //         type:"primary"
                                        //     },
                                        //     on:{
                                        //         click:()=>{
                                        //             this.$router.push({name:'downList-nocache',query:{id:params.row.userid,name:params.row.loginname}})
                                        //         }
                                        //     }
                                        // },"下级列表"),
                                        // h("Button",{
                                        //     props:{
                                        //         type:"primary"
                                        //     },
                                        //     on:{
                                        //         click:()=>{
                                        //             this.$router.push({name:'down-agent-nocache',query:{id:params.row.userid,name:params.row.loginname}})
                                        //         }
                                        //     }
                                        // },"下级区代"),
                                        // h("Button",{
                                        //     props:{
                                        //         type:"primary"
                                        //     },
                                        //     on:{
                                        //         click:()=>{
                                        //             this.id = params.row.userid
                                        //             this.modal3 = true
                                        //         }
                                        //     }
                                        // },"升级金牌"),
                                        // h("Button",{
                                        //     props:{
                                        //         type:"primary"
                                        //     },
                                        //     on:{
                                        //         click:()=>{
                                        //             this.id = params.row.userid
                                        //             this.alertAgent()
                                        //         }
                                        //     }
                                        // },"设为代理"),
                                    ])
                                ])
                            }
                        }
                    }
                ],
                coinList: [],
                data: [],
                total: 0,
                index: 1,
                page_con: 15,
                searchData: {
                    timeStartEnd: [],//两个时间内的赛选
                    loginName: "",//
                    userName: "",
                    userPhone: "",//
                    userType: "",
                    sort: "",
                    userStatus: "",
                    svip: "",
                    is_daili: "",
                    uid: '',
                    email: '',
                    userLevel: '',
                    activeState: '',
                    id: '',
                },
                remark: '',
                username: "",
                order_type: '',
                moneyTypeList: [],
                changeMoneyType: '',
                search_loading: false,
                id: "",
                type: 1,
                modal1: false,
                modal2: false,
                modal3: false,
                modal4: false,
                modal5: false,
                modal9: false,
                memberstatus: false,
                getUserMoney: false,
                modal_loading: false,
                changeUserMoney: false,
                get_myteam: false,
                formValidate: {
                    level: "",
                    status: "",
                    money: '',
                    change_money_type: '1',
                    inc_type: '1',
                    num: '',
                    remark: ''
                },
                ruleValidate: {
                    level: [{required: true, message: '请选择激活状态', trigger: 'change'}],
                    ststus: [{required: true, message: '请选择会员等级', trigger: 'change'}],
                    money: [{required: false, message: '请输入资金金额', trigger: 'blur'}],
                    change_money_type: [{required: true, message: '请选择资金种类', trigger: 'change'}],
                    inc_type: [{required: true, message: '请选择增加/减少', trigger: 'change'}],
                    num: [{required: true, message: '请输入资金金额', trigger: 'blur'}],
                    remark: [{required: false, message: '请输入备注', trigger: 'blur'}],
                },
                formValidateAgent: {
                    areaId1: "",
                    areaId2: "",
                    areaId3: "",
                    tuijian: "",
                    type: "",
                },
                ruleValidateAgent: {
                    areaId1: [{required: true, message: '请选择省', trigger: 'change'}],
                    areaId2: [{required: true, message: '请选择市', trigger: 'change'}],
                    areaId3: [{required: true, message: '请选择县', trigger: 'change'}],
                    tuijian: [{required: true, message: '请输入推荐人', trigger: 'blur'}],
                    type: [{required: true, message: '请选择类型', trigger: 'change'}],
                },
                areaId1List: [],//省级
                areaId2List: [],//市级
                areaId3List: [],//县
            }
        },
        activated() {
            this.getCoinList()
        },
        mounted() {

        },
        methods: {
            getCoinList() {
                this.getJsonData("Trade/getMatchUpPairs").then((res) => {
                    this.coinList = res.data
                    this.searchData.id = res.data[0].id
                    this.getOrderList()
                })
            },
            getOrderList() {
                this.getJsonData("Trade/getMatchUpList", {
                    // num:this.page_con,
                    // page:this.index,
                    // is_jihuo: this.searchData.activeState,
                    // level: this.searchData.userLevel,
                    status: this.searchData.userStatus,
                    // email: this.searchData.email,
                    // begin:this.searchData.timeStartEnd[0]?this.searchData.timeStartEnd[0]/1000:"",
                    // last:this.searchData.timeStartEnd[1]?this.searchData.timeStartEnd[1]/1000:"",
                    // loginName:this.searchData.loginName,
                    username: this.searchData.userName,
                    phone: this.searchData.userPhone,
                    id: this.searchData.id,
                    // userType:this.searchData.userType,
                    type:this.searchData.type,
                    // userStatus:this.searchData.userStatus,
                    // svip:this.searchData.svip,
                    // is_daili:this.searchData.is_daili,

                }, true)
                    .then((res) => {
                        this.data = res.data
                        this.total = parseInt(res.count)
                        this.search_loading = false
                    })
                    .catch((res) => {
                        this.search_loading = false
                    })
            },
            changePage(n) {
                this.index = n
                this.getOrderList()
            },
            changeTiao(num) {
                this.page_con = num
                this.index = 1
                this.getOrderList()
            },
            searchGetList() {
                this.search_loading = true
                this.index = 1
                this.getOrderList()
            },
            //删除
            del() {
                this.modal_loading = true;
                this.getJsonData("Trade/cancelMatchUp", {
                    trade_id: this.searchData.id,
                    type: this.order_type,
                    id: this.uid
                }, true)
                    .then((res) => {
                        this.getOrderList()
                        this.modal_loading = false;
                        this.modal1 = false;
                        this.$Message.success('取消成功');
                    }).catch((res) => {
                    this.modal_loading = false;
                    this.modal1 = false;
                })
            },
            //成为团队长
            // tuandui(){
            //     this.modal_loading = true;
            //     this.getJsonData("Users/runTuanduizhang",{userId:this.id,type:this.type},true)
            //         .then((res)=>{
            //             this.getOrderList()
            //             this.modal_loading = false;
            //             this.modal2 = false;
            //             this.$Message.success((this.type==1?'设置成功':'取消成功'));
            //         }).catch((res)=>{
            //         this.modal_loading = false;
            //         this.modal2 = false;
            //     })
            // },
            //升级金牌
            // shengji(){
            //     this.modal_loading = true;
            //     this.getJsonData("Users/upTuishou",{userId:this.id},true)
            //         .then((res)=>{
            //             this.getOrderList()
            //             this.modal_loading = false;
            //             this.modal3 = false;
            //             this.$Message.success("升级成功");
            //         }).catch((res)=>{
            //         this.modal_loading = false;
            //         this.modal3 = false;
            //     })
            // },
            //修改密码
            // changePwd(){
            //     this.$refs.formValidate.validate((valid) => {
            //         if (valid) {
            //             this.sureChangePwd()
            //         }
            //     })
            // },
            //确认修改
            // sureChangePwd(){
            //     this.modal_loading = true;
            //     this.getJsonData("Users/runUpdatepwd",{
            //         userId:this.id,
            //         pwd:this.formValidate.pwd,
            //         pwd_t:this.formValidate.repwd,
            //     },true)
            //         .then((res)=>{
            //             this.getOrderList()
            //             this.modal_loading = false;
            //             this.modal4 = false;
            //             this.$Message.success("修改成功");
            //         }).catch((res)=>{
            //         this.modal_loading = false;
            //         this.modal4 = false;
            //     })
            // },
            //修改会员等级
            changeLevel() {
                this.sureChangeLevel()
                // this.$refs.formValidate.validate((valid) => {
                //     if (valid) {
                //         this.sureChangeLevel()
                //         console.log(this.uid)
                //     }
                // })
            },
            //确认修改
            sureChangeLevel() {
                this.modal_loading = true;
                this.getJsonData("User/setUserLevel", {
                    uid: this.uid,
                    level: this.formValidate.level,
                }, true)
                    .then((res) => {
                        this.getOrderList()
                        this.modal_loading = false;
                        this.modal4 = false;
                        this.$Message.success("修改成功");
                    }).catch((res) => {
                    this.modal_loading = false;
                    this.modal4 = false;
                })
            },
            //修改会员等级
            changeStatus() {
                this.sureChangeStatus()
                // this.$refs.formValidate.validate((valid) => {
                //     if (valid) {
                //         this.sureChangeStatus()
                //     }
                // })
            },
            //确认修改
            sureChangeStatus() {
                this.modal_loading = true;
                this.getJsonData("User/setUserStatus", {
                    uid: this.uid,
                    status: this.formValidate.status,
                }, true)
                    .then((res) => {
                        this.getOrderList()
                        this.modal_loading = false;
                        this.memberstatus = false;
                        this.$Message.success("修改成功");
                    }).catch((res) => {
                    this.modal_loading = false;
                    this.memberstatus = false;
                })
            },
            //修改用户资金
            changeMoney() {
                // this.$refs.formValidate.validate((valid) => {
                //     if (valid) {
                //         this.sureChangeMoney()
                //     }
                // })
                this.sureChangeMoney()
            },
            //确认修改
            sureChangeMoney() {
                this.modal_loading = true;
                this.getJsonData("UserMoney/runUpdateUserMoney", {
                    uid: this.uid,
                    num: this.formValidate.num,
                    money_type: this.changeMoneyType,
                    inc_type: this.formValidate.inc_type,
                    desc: this.formValidate.remark,
                }, true)
                    .then((res) => {
                        this.getOrderList()
                        this.modal_loading = false;
                        this.changeUserMoney = false;
                        this.$Message.success("修改成功");
                    }).catch((res) => {
                    this.modal_loading = false;
                    this.changeUserMoney = false;
                })
            },
            //弹出设为代理获取升级列表
            // alertAgent(){
            //     this.getJsonData("Areas/getAreas",{parentId:""})
            //         .then((res)=>{
            //             this.areaId1List = res.data
            //             this.reset()
            //             this.modal5 = true
            //         })
            // },
            //获取市
            getAreaId2() {
                if (this.formValidateAgent.areaId1 !== "") {
                    this.getJsonData("Areas/getAreas", {parentId: this.formValidateAgent.areaId1})
                        .then((res) => {
                            this.areaId2List = res.data
                        })
                } else {
                    this.areaId2List = []
                    this.areaId3List = []
                }
            },
            //获取县
            getAreaId3() {
                if (this.formValidateAgent.areaId2 !== "") {
                    this.getJsonData("Areas/getAreas", {parentId: this.formValidateAgent.areaId2})
                        .then((res) => {
                            this.areaId3List = res.data
                        })
                } else {
                    this.areaId3List = []
                }
            },
            //设为代理
            setAgent() {
                this.$refs.formValidateAgent.validate((valid) => {
                    if (valid) {
                        this.surSetAgent()
                    }
                })
            },
            //确认设为代理
            surSetAgent() {
                this.modal_loading = true;
                this.getJsonData("Users/addAgent", {
                    userId: this.id,
                    is_yuding: this.formValidateAgent.type,
                    tuijian: this.formValidateAgent.tuijian,
                    consignee_add_countyId: this.formValidateAgent.areaId1,
                    consignee_add_countyId2: this.formValidateAgent.areaId2,
                    consignee_add_countyId3: this.formValidateAgent.areaId3,
                }, true)
                    .then((res) => {
                        this.getOrderList()
                        this.modal_loading = false;
                        this.modal5 = false;
                        this.$Message.success("设置成功");
                    }).catch((res) => {
                    this.modal_loading = false;
                    this.modal5 = false;
                })
            },
            reset() {
                this.$refs.formValidateAgent.resetFields();
            },
            sureActive() {
                this.modal_loading = true;
                this.getJsonData("User/jihuo", {uid: this.uid}, true)
                    .then((res) => {
                        this.getOrderList()
                        this.modal_loading = false;
                        this.modal9 = false;
                        this.$Message.success('激活成功');
                    }).catch((res) => {
                    this.modal_loading = false;
                    this.modal9 = false;
                })
            },
        },
    }
</script>
<style lang="less">
    @import "autoBuySell-list";
</style>